LNG File Format

LNG File Format

Description

LNG File is usual INI file. Each section represents a form to be translated. Sections named as form class ( for example [TForm1]). There is also one more section (initially it is missed but you can add it manually) for storing different strings - it is called [Messages]. Each row consists of item name and value in form <name>=<value>

Simple items

Item name consists of several identifiers separated by '.'. Each identifier represent component name or property name leftmost in name is topmost component in parent/child hierarchy. So if Label1 is placed on Panlel1 in LNG file you will find next row Panel1.Label1.Caption=... . All strings are represented in DFM style format:

For example:

Panel1.Label1.Caption=#9'First line'#10#13'second line.'

Non visual components like TActionList, TAction, TMainMenu and so on are written directly in form section without any prefix:

Action1.Caption='Action1'

TStrings items

TStrings properties are suffixed with Strings identifier so for memo it looks like:

Panel2.Memo1.Lines.Strings='I advise you to try Balmsoft ''Polyglot'' component','It is really easy to use'

Strings are quoted and special symbols are typed directly in strings. Each new line are separated by commas. Is is possible not use quotas for lines without quotation marks and commas but it is better to use quotas for better style. If you need place quote into string just double it (same rule as Delphi string constants).

Collection support

Collection items have not name (mostly) so it is impossible to specify them by name. Index is used for identifying collection items, so for collection item translation looks like:

Panel1.Panel2.DBGrid1.Columns.(2).Title.Caption='Salary'

It means that this row provides translation for property of collection item with index 2 from columns collection.

Resourcestring

All resource strings are placed in the [ResourceStrings] section. Common format for resource string representation is:

65182_bsPolyglotDemoFrm_strMessage1='Test Message.'

Please update your resource strings as often as possible , it uses string id in run-time and it can be changed by delphi. Updating lng file use string name so it change id and keep your translation.

Charset

There is one very important (but not very clear) property charset. It is a property of Font object and it plays big role in Font painting. In the LNG file you need to specify charset as integer number. So I placed here a list of charsets with their integer numbers:

ANSI_CHARSET = 0;
DEFAULT_CHARSET = 1;
SYMBOL_CHARSET = 2;
SHIFTJIS_CHARSET = $80;
HANGEUL_CHARSET = 129;
GB2312_CHARSET = 134;
CHINESEBIG5_CHARSET = 136;
OEM_CHARSET = 255;
JOHAB_CHARSET = 130;
HEBREW_CHARSET = 177;
ARABIC_CHARSET = 178;
GREEK_CHARSET = 161;
TURKISH_CHARSET = 162;
VIETNAMESE_CHARSET = 163;
THAI_CHARSET = 222;
EASTEUROPE_CHARSET = 238;
RUSSIAN_CHARSET = 204;
MAC_CHARSET = 77;
BALTIC_CHARSET = 186;

You can find original constants in Windows.pas